<!DOCTYPE html>
<html>
  <head lang="en">
    <meta charset="UTF-8" />
    <title></title>
    <style>
      body {
        font-size: 30px;
        text-align: center;
        color: red;
      }
      * {
        margin: 0;
        padding: 0;
      }
      .box {
        width: 200px;
        height: 200px;
        margin: 200px auto;
        position: relative;
        transform-style: preserve-3d;
        transform: rotateX(-50deg) rotateY(20deg);
        animation: move 5s linear infinite;
        animation-timing-function: ease-in-out;
      }
      @keyframes move {
        0% {
          transform: rotateX(-50deg) rotateY(20deg);
        }
        100% {
          transform: rotateX(360deg) rotateY(360deg);
        }
      }
      .box > div {
        width: 100%;
        height: 100%;
        position: absolute;
      }
      .box-top {
        background-image: url(img.png);
        transform: translateZ(100px);
      }
      .box-bot {
        background-image: url(img1.png);
        transform: translateZ(-100px);
      }
      .box-rit {
        transform: translateX(100px) rotateY(90deg);
      }
      .box-lft {
        transform: translateX(-100px) rotateY(90deg);
      }
      .box-frt {
        transform: translateY(100px) rotateX(90deg);
      }
      .box-bak {
        transform: translateY(-100px) rotateX(90deg);
      }
      img {
        width: 100%;
        height: 100%;
        opacity: 0.5;
      }
    </style>
    <script>
      window.onload = function () {
        var demo = document.getElementById("demo");
        var endTime = new Date("2021/3/28 17:00:00"); // 最终时间
        setInterval(clock, 1000); // 开启定时器
        function clock() {
          var nowTime = new Date(); // 一定是要获取最新的时间
          // console.log(nowTime.getTime()); 获得自己的毫秒
          var second = parseInt((endTime.getTime() - nowTime.getTime()) / 1000);
          // 用将来的时间毫秒 - 现在的毫秒 / 1000 得到的 还剩下的秒 可能处不断 取整
          // console.log(second);
          // 一小时 3600 秒
          // second / 3600 一共的小时数 /24 天数
          var d = parseInt(second / 3600 / 24); //天数
          //console.log(d);
          var h = parseInt((second / 3600) % 24); // 小时
          // console.log(h);
          var m = parseInt(second / 60);
          //console.log(m);
          var s = parseInt(second); // 当前的秒
          console.log(s);
          /* if(d<10)
  {
   d = "0" + d;
  }*/
          d < 10 ? (d = "0" + d) : d;
          h < 10 ? (h = "0" + h) : h;
          m < 10 ? (m = "0" + m) : m;
          s < 10 ? (s = "0" + s) : s;
          demo.innerHTML =
            "距淑荣小可爱培训结束时间: " +
            d +
            "天 " +
            h +
            "小时 " +
            m +
            "分钟 " +
            s +
            "秒";
        }
      };
    </script>
  </head>
  <body>
    <div id="demo"></div>
    <div class="box">
      <div class="box-top"><img src="./imgs/xiao.jpg" alt="" /></div>
      <div class="box-bot"><img src="./imgs/ke.jpg" alt="" /></div>
      <div class="box-rit"><img src="./imgs/ai.jpg" alt="" /></div>
      <div class="box-lft"><img src="./imgs/ke.jpg" alt="" /></div>
      <div class="box-frt"><img src="./imgs/xiao.jpg" alt="" /></div>
      <div class="box-bak"><img src="./imgs/ai.jpg" alt="" /></div>
    </div>
  </body>
</html>
